var mongoose = require('mongoose');
var Products = require('../data/models/product');
var product = new Products({
    name: '自行车',
    description: '快',
    catagory: '交通',
    price: '1000'
});

exports.index = function(req,res) {
    Products.find({}, function(err,productList) {
        if(err) {
            console.log(err);
        }
        res.render('index',{
            title:'Sport Store',
            prod: productList,
            user: req.session.user
        });
    });
};